package vip.ola.service.dao.mapper.code;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import vip.ola.core.common.vo.UserDayProfitVO;
import vip.ola.core.entity.code.CodeOrder;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 二维码订单信息 Mapper 接口
 * </p>
 *
 * @author faker
 * @since 2020-03-25
 */
public interface CodeOrderMapper extends BaseMapper<CodeOrder> {

    IPage<CodeOrder> list(Page page, @Param("order") CodeOrder order);

    List<CodeOrder> getRiskOrder(@Param("count") int count, @Param("codeBusId") Long codeBusId);

    CodeOrder getByCodeOrder(@Param("order") CodeOrder codeOrder);

    CodeOrder getByOrderNo(@Param("orderNo") String orderNo);

    Map<String, Object> countTodayCollAmountByCodeId(@Param("codeId") long codeId);

    /**
     * 统计所有订单
     *
     * @return
     */
    Map countAll(CodeOrder order);

    /**
     * 统计成功订单
     *
     * @return
     */
    Map countSuccess(CodeOrder order);

    /**
     * 统计未付订单
     *
     * @return
     */
    Map countFail(CodeOrder order);

    List<UserDayProfitVO> countSuccessByUser(@Param("codeBusId") Long codeBusId, @Param("date")LocalDate date);

}
